class Solution {
public:
    vector<int> temp;
    vector<vector<int>> ans;
    void dfs(vector<int> &nums,int index){
        if (index==nums.size()){
            ans.push_back(temp);
            return;
        }
        temp.push_back(nums[index]);
        dfs(nums,index+1);
        temp.pop_back();
        dfs(nums,index+1);
    }
    vector<vector<int>> subsets(vector<int>& nums) {
        dfs(nums,0);
        return ans;
    }
};